home *** CD-ROM | disk | FTP | other *** search
- /*
- File: History.h
-
- Description:
- This file contains routine prototypes and type declarations that can
- be used to access the routines defined in History.c These routines
- are used to store visitled links.
-
- HTMLSample is an application illustrating how to use the new
- HTMLRenderingLib services found in Mac OS 9. HTMLRenderingLib
- is Apple's light-weight HTML rendering engine capable of
- displaying HTML files.
-
- Copyright:
- © Copyright 1999 Apple Computer, Inc. All rights reserved.
-
- Disclaimer:
- IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
- ("Apple") in consideration of your agreement to the following terms, and your
- use, installation, modification or redistribution of this Apple software
- constitutes acceptance of these terms. If you do not agree with these terms,
- please do not use, install, modify or redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject
- to these terms, Apple grants you a personal, non-exclusive license, under Apple’s
- copyrights in this original Apple software (the "Apple Software"), to use,
- reproduce, modify and redistribute the Apple Software, with or without
- modifications, in source and/or binary forms; provided that if you redistribute
- the Apple Software in its entirety and without modifications, you must retain
- this notice and the following text and disclaimers in all such redistributions of
- the Apple Software. Neither the name, trademarks, service marks or logos of
- Apple Computer, Inc. may be used to endorse or promote products derived from the
- Apple Software without specific prior written permission from Apple. Except as
- expressly stated in this notice, no other rights or licenses, express or implied,
- are granted by Apple herein, including but not limited to any patent rights that
- may be infringed by your derivative works or by other works in which the Apple
- Software may be incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
- WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
- WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
- COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
- OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
- (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Change History (most recent first):
- Wed, Dec 22, 1999 -- created
- */
-
-
-
- #ifndef __HISTORY__
- #define __HISTORY__
-
- #include <Types.h>
- #include <Menus.h>
-
-
- /* HistoryDataHandle defines the data type we are using
- for storing historical information about visited links.
- A history is maintained as a list/stack where we can
- move backwards and forwards referencing elements as
- required. The only difference between a history and
- a stack is that if we add a new element to the history,
- then all elements beyond the current reference are
- deleted before the new element is added. */
- typedef struct HistoryData HistoryData;
- typedef HistoryData *HistoryDataPtr, **HistoryDataHandle;
-
-
- /* NewHistory creats a new history and returns
- a handle to it. */
- HistoryDataHandle NewHistory(void);
-
-
- /* DisposeHistory disposes of a history and all of the
- structures allocated for it. */
- void DisposeHistory(HistoryDataHandle hd);
-
-
- /* AddToHistory adds a new element to the history. Both
- the URL and the printed representation of its url
- are stored. NOTE: if we have called GoBack a few times
- before this call, then those previously viewed items
- are removed from the history. This is so if we choose
- GoBack again, then we will arrive at the same link we
- are looking at now. */
- OSErr AddToHistory(HistoryDataHandle hd, char const* url, StringPtr printName);
-
-
- /* InHistory returns true if the URL is among the urls
- currently stored in the history. */
- Boolean InHistory(HistoryDataHandle hd, char const* url);
-
- /* CanGoBack returns true if it makes sense to call the
- GoBack command. i.e. if there are one or more links
- in the history beyond the current one. */
- Boolean CanGoBack(HistoryDataHandle hd);
-
- /* GoBack copies the previous url in the history
- into a new handle and returns that handle in
- *url. It is the caller's responsibility to dispose
- of the handle after it has been used. */
- OSErr GoBack(HistoryDataHandle hd, Handle *url);
-
-
- /* CanGoForward returns true if it makes sense to call the
- GoForward command. i.e. if there are one or more links
- in the history ahead of the current one. This can only
- happen after the user has chosen GoBack one or more
- times. */
- Boolean CanGoForward(HistoryDataHandle hd);
-
-
- /* GoForward copies the next url in the history
- into a new handle and returns that handle in
- *url. It is the caller's responsibility to dispose
- of the handle after it has been used. */
- OSErr GoForward(HistoryDataHandle hd, Handle *url);
-
-
- /* CanGoHome returns true if it makes sense to call the
- GoHome command. i.e. if there are one or more links
- in the history. This can only happen after AddToHistory
- has been called one or more times. */
- Boolean CanGoHome(HistoryDataHandle hd);
-
-
- /* GoBack copies the first url in the history
- into a new handle and returns that handle in
- *url. It is the caller's responsibility to dispose
- of the handle after it has been used. */
- OSErr GoHome(HistoryDataHandle hd, Handle *url);
-
-
- /* AppendHistoryToMenu rebuilds the Go menu adding items to the
- bottom of the menu according to the items in the
- history. The names of the items are the same as
- the printNames provided in the AddToHistory command. */
- OSErr AppendHistoryToMenu(HistoryDataHandle hd, MenuHandle theMenu);
-
-
- /* GoToMenuItem copies the itemIndex'th url in the history
- into a new handle and returns that handle in
- *url. It is the caller's responsibility to dispose
- of the handle after it has been used. This routine
- should only be called after a menu selection has
- been made in a menu built by AppendHistoryToMenu. */
- OSErr GoToMenuItem(HistoryDataHandle hd, Handle *url, short itemIndex);
-
-
- #endif
-
-